package com.itheima.health.service.impl;

import com.itheima.health.dao.MemberDao;
import com.itheima.health.pojo.Member;
import com.itheima.health.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 会员SERVICE实现类
 */
@Service
@Slf4j
public class MemberServiceImpl implements MemberService {
    @Autowired
    private MemberDao memberDao;

    @Override
    public Member selectByPhoneNumber(String telephone) {
        Member member = memberDao.selectByPhoneNumber(telephone);
        log.info("[会员-根据手机号查询]data:{}",telephone);
        return member;
    }

    @Override
    public Integer register(Member member) {
        Integer id = memberDao.insert(member);
        log.info("[会员-注册]id:{}",id);
        return id;
    }

    @Override
    public Member findById(Integer id) {
        Member member = memberDao.findById(id);
        return member;
    }
}
